package org.desktop.web.client.gui;

import java.util.HashMap;
import java.util.Map;

import com.google.gwt.core.shared.GWT;
import com.sencha.gxt.data.client.loader.RpcProxy;

public class RpcProxyPool<Rpc extends RpcProxy<?, ?>> {
	
	private Map<String, Rpc> pool = new HashMap<String, Rpc>();
	
	private static RpcProxyPool<RpcProxy<?,?>> singleton;
	
	

	private RpcProxyPool() {
	}

	public static RpcProxyPool<RpcProxy<?,?>> getInstance(){
		return singleton==null?new RpcProxyPool<RpcProxy<?,?>>():singleton;
	}

	
	public void registerProxy(String nameProxy,Rpc rpc){
		pool.put(nameProxy, rpc);
	}
	
	public Rpc getProxy(String name){
		return pool.get(name);
	}

}
